<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<c:set var="reportTitle" value="halm机测试 - 线别效能报表" scope="session"/>

<%@ include file="/common/report_head.jsp" %>
<%@ include file="/condition/sartTime_YMDH_input.html"%>
<%@ include file="/condition/endTime_YMDH_input.html"%>
<%@ include file="/condition/fab_sumo_must.html"%>
<%@ include file="/condition/effNo_sumo.html"%>
<%--<%@ include file="/condition/attributes_sumo.html"%>--%>
<%@ include file="/condition/line_sumo.html"%>
<%@ include file="/condition/toolg_sumo.html"%>
<%@ include file="/condition/toolType_radio.html"%>
<%@ include file="/condition/tool_sumo.html"%>
<%@ include file="/condition/spec_sumo.html"%>
<%@ include file="/condition/waferSpec_sumo.html"%>
<%@ include file="/condition/manufacturer_sumo.html"%>
<%@ include file="/condition/baseIdsumo.html"%>
<%@ include file="/condition/lotId_text.html"%>
<%@ include file="/condition/gear_sumo.html"%>

<%@ include file="/common/report_middle.jsp" %>
<div class="col-md-12" style="height: 820px;">
    <div id="pqGrid"></div>
</div>
<%@include file="/common/report_end.jsp" %>


<script>
    $(document).ready(function () {
        $("title").text("halm机测试 - 线别效能报表");
        $("label:contains('线别:')").addClass("keyCss");

        $('#query_btn').click(function (){
            if($("#bayIdSumo").val() === null || $("#bayIdSumo").val() === '' ) { showErrorDialog("0000002", "线别为必选项"); return false; }
            initGridAndChart();
            ajax('/jn-report/report/halm_lineEfficiency_report.do' ,loadConditionMapData(), true, ajax_successful);

            function ajax_successful(outTrxObj) {
                if(outTrxObj.gridData.length < 1) { showMessengerDialog("数据查询为空"); return false; }

                //grid表格数据
                if ($("#pqGrid").length > 0) {
                    var colM = [];
                    var lot_id = $.trim($("#lotIdText").val());
                    if (lot_id == undefined || lot_id == null || lot_id == "") {
                        colM.push({halign:"center",align:'center',dataIndx:'date'		        ,title: '日期',	       width: 150,   editable: false, sortable: true});
                        colM.push({halign:"center",align:'center',dataIndx:'line_id'	        ,title: '线别',	       width: 110,   editable: false, sortable: true});
                        colM.push({halign:"center",align:'center',dataIndx:'line_id_fk'	        ,title: '线别',	       width: 110,   editable: false, sortable: true, hidden: true});
                        colM.push({halign:"center",align:'center',dataIndx:'tool_id'	        ,title: '设备',	       width: 170,   editable: false, sortable: true});
                        colM.push({halign:"center",align:'center',dataIndx:'tool_id_fk'	        ,title: '设备',	       width: 170,   editable: false, sortable: true, hidden: true});
                    }else {
                        colM.push({halign:"center",align:'center',dataIndx:'lot_id'		        ,title: '批次号',	     width: 130,   editable: false, sortable: true});
                        colM.push({halign:"center",align:'center',dataIndx:'feeding_start_date'	,title: '投料开始日期',	 width: 170,   editable: false, sortable: true});
                        colM.push({halign:"center",align:'center',dataIndx:'feeding_end_date'	,title: '投料结束日期',	 width: 170,   editable: false, sortable: true});
                    }
                    colM.push({halign:"center",align:'center',dataIndx:'good_rate'	        ,title: '良品比例',      width: 90,   editable: false, sortable: true});
                    colM.push({halign:"center",align:'center',dataIndx:'good_eta_rate'        ,title: 'Eta',	       width: 90,   editable: false, sortable: true});
                    colM.push({halign:"center",align:'center',dataIndx:'good_uoc_rate'        ,title: 'Uoc',	       width: 90,   editable: false, sortable: true});
                    colM.push({halign:"center",align:'center',dataIndx:'good_isc_rate'        ,title: 'Isc',	       width: 90,   editable: false, sortable: true});
                    colM.push({halign:"center",align:'center',dataIndx:'good_ff_rate'	        ,title: 'FF',	       width: 90,   editable: false, sortable: true});
                    colM.push({halign:"center",align:'center',dataIndx:'good_rserIEC891_rate' ,title: 'RserIEC891',  width: 110,  editable: false, sortable: true});
                    colM.push({halign:"center",align:'center',dataIndx:'good_rshuntDfDr_rate' ,title: 'RshuntDfDr',  width: 110,  editable: false, sortable: true});
                    colM.push({halign:"center",align:'center',dataIndx:'good_irev2_rate'      ,title: 'Irev2',       width: 90,   editable: false, sortable: true});
                    colM.push({halign:"center",align:'center',dataIndx:'good_iRTmax_rate'     ,title: 'IRTmax',      width: 90,   editable: false, sortable: true});
                    for (var i=0; i<outTrxObj.dynamicColumn.length; i++){
                        var gear = outTrxObj.dynamicColumn[i];
                        colM.push({halign:'center', align:'center',  dataIndx: gear + '比例', title: gear + '比例', width: 130, editable: false, sortable: true});
                    }
                    colM.push({halign:"center",align:'center',dataIndx:'count'	        ,title: '计数',	       width: 110,   editable: false, sortable: true});
                    colM.push({halign:"center",align:'center',dataIndx:'good_count'	    ,title: '良品数',      width: 110,   editable: false, sortable: true});
                    for (var i=0; i<outTrxObj.dynamicColumn.length; i++){
                        var gear = outTrxObj.dynamicColumn[i];
                        colM.push({halign:'center', align:'center',  dataIndx: gear + '数量', title: gear + '数量', width: 130, editable: false, sortable: true});
                    }
                    _pqUtil.f.setColModel($("#pqGrid"), colM);
                    _pqUtil.f.seTitle($("#pqGrid"), "各线效率");
                    _pqUtil.f.isShowTitle($("#pqGrid"), false);
                    _pqUtil.f.loadPqGridData($("#pqGrid"), outTrxObj.dynamicColumnJsonGridData);
                }
            }
        });

        $("#query_btn").after('<button id="export_btn" style="width: 80px;height: 23px;margin-top: 5px;margin-right: 10px;background-color: #F5F5F5;font-size: 14px;font: \'微软雅黑\';font-weight: bold;color: #428bca;border: 1px solid #191970;">导出</button>');
        $("#export_btn").click(function (){
            alert("到出源数据到Excel");
            postData(JSON.stringify(loadConditionMapData()), "halm机源数据-导出", "halm_exportExcel.do", false);
        });
    });
</script>
